package drds.server.util;

public class CompareUtil {
	public static int compareInt(int l, int r) {

		if (l > r) {
			return 1;
		} else if (l < r) {
			return -1;
		} else {
			return 0;
		}

	}

	public static int compareDouble(double l, double r) {

		if (l > r) {
			return 1;
		} else if (l < r) {
			return -1;
		} else {
			return 0;
		}

	}

	public static int compareFloat(float l, float r) {

		if (l > r) {
			return 1;
		} else if (l < r) {
			return -1;
		} else {
			return 0;
		}

	}

	public static int compareLong(long l, long r) {
		if (l > r) {
			return 1;
		} else if (l < r) {
			return -1;
		} else {
			return 0;
		}

	}

	public static int compareString(String l, String r) {
		if (l == null) {
			return -1;
		} else if (r == null) {
			return 1;
		}
		return l.compareTo(r);
	}

	public static int compareChar(char l, char r) {

		if (l > r) {
			return 1;
		} else if (l < r) {
			return -1;
		} else {
			return 0;
		}

	}

	public static int compareUtilDate(Object left, Object right) {

		java.util.Date l = (java.util.Date) left;
		java.util.Date r = (java.util.Date) right;

		return l.compareTo(r);

	}

	public static int compareSqlDate(Object left, Object right) {

		java.sql.Date l = (java.sql.Date) left;
		java.sql.Date r = (java.sql.Date) right;

		return l.compareTo(r);

	}
}